package com.alibaba.cloud.clinic.controller;

import com.alibaba.cloud.clinic.dto.ClinicOrderDTO;
import com.alibaba.cloud.clinic.entity.ClinicOrder;
import com.alibaba.cloud.clinic.service.ClinicOrderService;
import com.alibaba.framework.domain.ResponseWrapper;
import com.alibaba.framework.wrapper.RedisWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/clinicOrder")
public class CliOrderController {

    @Autowired
    private ClinicOrderService clinicOrderService;

    @Autowired
    private RedisWrapper redisWrapper;

    @GetMapping("/list")
    public ResponseWrapper getAll() {

        List<ClinicOrder> clinicOrderList = clinicOrderService.getAll();
        return ResponseWrapper.Success(clinicOrderList);
    }

    /**
     * @descript 保存处方
     * @author focus
     * @date 2025/10/14
     */
    @PostMapping("/save")
    public ResponseWrapper saveOrder(@RequestBody List<ClinicOrderDTO> clinicOrderDTOList) {

        clinicOrderService.saveOrder(clinicOrderDTOList);
        return ResponseWrapper.Success();
    }

    // 查询药品列表，开具药品处方
    // Redis-Hash  <药房类别-医嘱类别, <药品名拼音简写， 药品>>  <门诊西药房-西药, <GMLKL, 感冒灵颗粒>>
}
